let user =  {
    namespaced: true,
    actions: {
        setStatus(context,value){
            context.commit('setStatus',value)
        },
        setMe(context,value){
          context.commit('setMe',value)
        }
    },
    mutations: {

        setStatus(state,status){
            state.loginStatus = status
            state.token = localStorage.getItem('satoken')
        },
        setMe(state,me){
            state.me = me
        }

    },
    state: {
        loginStatus: false,
        token: '',
        username: '',
        me:{}
    },

    getters: {
        loginStatus : (state)=> localStorage.getItem('satoken') !== '',
        me: (state)=>JSON.parse(localStorage.getItem("me"))
    }
}

export default user